#include <string.h>

#ifdef __SDCC_BROKEN_STRING_FUNCTIONS
char * strrchr( const char * string, char ch )
#else
char * strrchr( const char * string, int ch )
#endif
{
  const char * start = string;
  while( *string++ ) ;
  /* search towards front */
  while( --string != start && *string != ch ) ;
  if( *string == ch ) {
    return( ( char * )string );
  }
  return ( NULL ) ;
}
